from PyQt5.QtWidgets import QApplication, QDialog
from login_ui import Ui_LoginDialog


class LoginDialog(QDialog):
    def __init__(self):
        super().__init__()
        self.ui = Ui_LoginDialog()
        self.ui.setupUi(self)
        self.ui.loginButton.clicked.connect(self.login)

    def login(self):
        username = self.ui.usernameLineEdit.text()
        password = self.ui.passwordLineEdit.text()
        # 在这里编写验证登录逻辑
        if username == "admin" and password == "123456":
            print("登录成功")
        else:
            print("登录失败")


if __name__ == "__main__":
    app = QApplication([])
    dialog = LoginDialog()
    dialog.show()
    app.exec_()
